<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html><head><title>Bus Sniffer</title>
<meta http-equiv="Content-Type" content="text/html; charset=8859-1">
</head><body><p>Here is a simple <i>HTTP Bus</i> get/post tool.</p>
<h2>Post a  message</h2>

<form action="javascript:postClick()">
 <input type="text" id="myLabel">
 <input type="text" id="myMessage">
 <input type="submit" value="POST">
</form>


<h2>Last message trace</h2>
<pre id="trace" name="trace"  style="border:2px solid black;background:#EFE;min-height:100px"></pre>
<!-- Invisible resources -->

<script type="text/javascript">

var get_xhr = new XMLHttpRequest();
var post_xhr = new XMLHttpRequest();
get_xhr.multipart = true;       
get_xhr.onload = function(e)   
{           
 var channel_message = this.responseText.split("\n") ;
 document.getElementById('trace').innerHTML += channel_message[0] + ':' + channel_message[1].replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;') + "\n";
};       

get_xhr.open('GET', "/bus/**?label&push=XXX", true);       
get_xhr.send(null);    

function handballerPost(label, body) {
  post_xhr.open('POST', "/bus/" + label, false);
  post_xhr.send(body);
}

function postClick(){
  label = document.getElementById('myLabel').value;
  body = document.getElementById('myMessage').value;

  handballerPost(label, body);
}

</script>


</body>
</html>
